﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xejen.Database.Ef
{
    /// <summary>
    /// 表示数据库上下文<see langword="DbContext"/>对象的提供器
    /// </summary>
    /// <typeparam name="TDbContext">表示<see cref="DbContext"/>的具体对象类型</typeparam>
    /// <creator>marc</creator>
    public interface IDbContextProvider<TDbContext>
        where TDbContext : DbContext
    {
        /// <summary>
        /// 表示<typeparamref name="TDbContext"/>对象
        /// </summary>
        TDbContext DbContext { get; }

        /// <summary>
        /// 获取<typeparamref name="TDbContext"/>对象
        /// </summary>
        /// <returns></returns>
        TDbContext GetDbContext();

        /// <summary>
        /// 获取<typeparamref name="TDbContext"/>对象
        /// </summary>
        /// <returns></returns>
        Task<TDbContext> GetDbContextAsync();
    }
}
